package com.xzx.source;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.RPC;

import java.io.IOException;

/**
 * 自定义RPC服务端
 *
 * @author xinzhixuan
 * @version 1.0
 * @date 2021-07-11 11:07 下午
 */
public class MyNameNodeServer implements RPCProtocol {
    public static void main(String[] args) throws IOException {
        RPC.Server server = new RPC.Builder(new Configuration())
                .setBindAddress("localhost").setPort(8888)
                .setProtocol(RPCProtocol.class)
                .setInstance(new MyNameNodeServer()).build();
        System.out.println("服务端开始工作");
        server.start();
    }

    @Override
    public void mkdirs(String path) {
        System.out.println("服务端收到客户端创建文件夹请求" + path);
    }
}
